//
//  BackBoxListVC.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2020/7/28.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "BackBoxListVC.h"
#import "BackBoxCell.h"
#import "TurnOverBoxModel.h"

@interface BackBoxListVC ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) NSMutableArray <TurnOverBoxModel *>*array;
@property (nonatomic, strong) UITableView *tableView;

@end

@implementation BackBoxListVC

-(UITableView *)tableView {
    if (!_tableView) {
        _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, ScreenH - BottomHeight - 64 - NaviHeight - 40) style:UITableViewStyleGrouped];
        _tableView.backgroundColor = Color_backgroundColor;
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _tableView;
}

-(NSMutableArray<TurnOverBoxModel *> *)array {
    if (!_array) {
        _array = [NSMutableArray array];
        TurnOverBoxModel *model1 = [TurnOverBoxModel new];
        model1.boxNO = @"42369563298";
        model1.ownMaster = @"3PL公司名称";
        model1.rentMaster = @"发货方公司名称";
        model1.status = 1;
        [_array addObject:model1];
        
        TurnOverBoxModel *model2 = [TurnOverBoxModel new];
        model2.boxNO = @"423695632782";
        model2.ownMaster = @"3PL公司名称";
        model2.rentMaster = @"发货方公司名称";
        model2.status = 2;
        [_array addObject:model2];
        
        TurnOverBoxModel *model3 = [TurnOverBoxModel new];
        model3.boxNO = @"423695632780";
        model3.ownMaster = @"3PL公司名称";
        model3.rentMaster = @"发货方公司名称";
        model3.status = 3;
        [_array addObject:model3];
    }
    return _array;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"返箱管理";
    [self.view addSubview:self.tableView];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.array.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    BackBoxCell *cell = [BackBoxCell BackBoxCellWithTableView:tableView];
    cell.model = self.array[indexPath.row];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    BackBoxCell *cell = [BackBoxCell BackBoxCellWithTableView:tableView];
    return cell.height;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenW, 10)];
    view.backgroundColor = [UIColor clearColor];
    return view;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 10;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    return [UIView new];
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
